How to make a PostgreSQL trigger thread-safe
According to this post, all triggers execute as part of the same transaction as the original query, so you would not need a lock statement:
https://stackoverflow.com/questions/10727335/after-insert-trigger-in-separate-transaction