MySQL and an atomic 'check on none insert'
blog.fastmail.com