title: PyMySQL and deadlock
body: <p>For some reason I'm getting randomly an error message</p>
  
  <pre><code>pymysql.err.OperationalError: (1213, 'Deadlock found when trying to get lock; try restarting transaction')
  </code></pre>
  
  <p>on a simple update query which looks like</p>
  
  <pre><code>updateQuery = "UPDATE %s SET valid = 1 WHERE uid = %s"
  updateValues = (table, uid)
  cursor.execute(updateQuery, updateValues)
  db.commit()
  </code></pre>
  
  <p>Any thoughts on that? MySQL bug rather than code?</p>