UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bZr10shVS7eOkKsS0cLfIqWnjoNYWOICUlUDJva2uks=' 
WHERE 
  key_id = '2eef37c4bf25bc2b1550c37d3aa2838b3e3969ac787178a066bd44d4823045f5' 
  AND (
    token = 'bZr10shVS7eOkKsS0cLfIqWnjoNYWOICUlUDJva2uks=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029