You can lock a row in a Postgres table by using FOR UPDATE in a SELECT query. The row will stay locked until the transaction is over.

Read more
Subscribe to PostgreSQL