UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jBsaFj2YVaRvZg1YmcgL3Fv8fdbraNG1Qgj689z7Kc8=' 
WHERE 
  key_id = 'f712c07c1bdb355c9c2839d3b591d5234c5c6c8e3c15c98e32def2cd63a66cdf' 
  AND (
    token = 'jBsaFj2YVaRvZg1YmcgL3Fv8fdbraNG1Qgj689z7Kc8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053