begin transaction; update "LockTable" set LockTime=CURRENT_TIMESTAMP where LockTable = 'MyTable'; insert into "MyTable" values (a, b, c, etc.); update "LockTable" set LockTime=NULL where LockTable = 'MyTable'; commit transaction;