UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W2b+w4OrvvYbXMwBRcWecWysIjCvPSF86a/CrUeGXBc=' 
WHERE 
  key_id = '4d6f4d016f7c7c1b10a8c081086f0c3712edcfaf95679a53b897b44f531fa2bf' 
  AND (
    token = 'W2b+w4OrvvYbXMwBRcWecWysIjCvPSF86a/CrUeGXBc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028