SELECT FOR UPDATE (NOWAIT) on auxilliary table for serializing updates?
You could use transaction level advisory locks to serialize your operations:
BEGIN;
-- take an advisory lock for the duration of the session
SELECT pg_advisory_xact_lock(4711);
SELECT * FROM inventory_use;
INSERT INTO inventory_use (ref) VALUES ('T1 insert');
COMMIT;

The number 4711 is an arbitrary constant.
Then the second transaction using the same code will block until the first one has committed.