SELECT ... FOR UPDATE
To explicitly lock a database row prior to updating, a SELECT...FOR
UPDATE
statement may be used to instruct the database server to lock the row
that was selected. SELECT ... FOR UPDATE
cannot be used outside of an
explicit transaction. The locks are held until the end of the transaction.