As you are updating the record inside a transaction the lock might be in place, see: https://hevodata.com/learn/postgresql-locks/#What_is_PostgreSQL_Locks
To prevent this you can change your microfow to retireve smaller batches, commit the batch outside the loop for performance and before retrieving the next batch use the EndTransaction java action from the Community Commons module so that the current transaction is ended and a new transaction is started.
This will improve perfromance and make sure that records aren't locked for too long a time.