Does this cause a race condition with MySQL (InnoDB):
Start Transaction.
Try to get record.
If record doesn\'t exist, return
Use 'select for update' at step 2. Only one process will be able to get a lock on the row thus avoiding the scenario you described.