UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o8G0uC1aO2IFg/j1+n0IebvB5Due9Iga4SPYzchiEgo=' 
WHERE 
  key_id = '17f8d48d8aa02378a3283fc2a0ed23c8f0836914fda8d023556136a1db403819' 
  AND (
    token = 'o8G0uC1aO2IFg/j1+n0IebvB5Due9Iga4SPYzchiEgo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017