The correct way to do this is to update the row at the beginning and at the end. The steps from creating the statement are below.
- create Statement
- update the row with its existing values (or the changed values if it is known at this point)
- perform other operations
- update the row with changed values (if not done before)
- commit
If you don't do it like the above, another transaction could change the row before this transaction can change it.