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

Query time 0.00035