UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FR4zGt3mXkgEwolaBorU3MPZR2aWNSidmzB2mmckTkw=' 
WHERE 
  key_id = '765341106eeb3cc22d6c8f1432a66aae4012614ee3cfe55c27c6fb755d9932fc' 
  AND (
    token = 'FR4zGt3mXkgEwolaBorU3MPZR2aWNSidmzB2mmckTkw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036