You need to issue a begin transaction
and commit transaction
statements before/after the actual SQL update statement. That will protect you from other activities from interfering with your transaction.
That will also guarantee that your update gets written to the database in a serialized fashion. First in, first updated.