UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '16ZgiEDOqGSJEwxzteYhSjpptLjN7ifDf8OT14E+y64=' 
WHERE 
  key_id = 'd1800c6b4ef894aec30dda1ddbde0a3e5995283900b769651b92ac88a33594d7' 
  AND (
    token = '16ZgiEDOqGSJEwxzteYhSjpptLjN7ifDf8OT14E+y64=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038