UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J/d5ykhgInYyLydnovlG1ITV1bQPgVi3cvfsiyxivRo=' 
WHERE 
  key_id = '5399f2c09290a3963c0fa274741e891506e750ccfc745c41a7343699815824c1' 
  AND (
    token = 'J/d5ykhgInYyLydnovlG1ITV1bQPgVi3cvfsiyxivRo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025