UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l8NLpM1Ov//Mnr632TZussvyrzF9td0drmBO5+yWkOI=' 
WHERE 
  key_id = 'c09cc72a3574036be0ee8d45b018246869e94c7783f4de9dae9bbb203c41c356' 
  AND (
    token = 'l8NLpM1Ov//Mnr632TZussvyrzF9td0drmBO5+yWkOI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00074