UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LfJF5D7EYtg03veYYPychMjx8tqtgMRhpBS0JtsMJws=' 
WHERE 
  key_id = '5abdf28d3d6f3f4cfede8e73459b586a313926b05509c02621d963f1a51fab23' 
  AND (
    token = 'LfJF5D7EYtg03veYYPychMjx8tqtgMRhpBS0JtsMJws=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020