Safer enqueueOnce logic, locking tables before checking for process existence.