title: Proper locking for reliable insertion (MySQL)
body: <p>When receiving so called IPN message from PayPal, I need to update a row in my database.</p>
  
  <p>The issue is that I need perfect reliability.</p>
  
  <p>Currently I use InnoDB. I am afraid that the transaction may fail due a race condition.</p>
  
  <p>Should I use <code>LOCK TABLES</code>? Any other reliable solution?</p>
  
  <p>Should I check for a failure and repeat the transaction several (how many?) times?</p>