UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fJbuFNk2Ib2SJCztjm1+z7HhBumDLkaFs66m8JxvOVo=' 
WHERE 
  key_id = '496ea21f214974023ed6fe44bddcca6078a60054b45a61799adc0aaaffaa337d' 
  AND (
    token = 'fJbuFNk2Ib2SJCztjm1+z7HhBumDLkaFs66m8JxvOVo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031