Rework locking mechanism so that it works for new records (using advisory locks).