UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iWF8DsJc2EehzQqODVlpHLFTjgosY/1Y+3iH8YpssBk=' 
WHERE 
  key_id = 'd1edccee6d56cd39b1ad8c0467ad41e3306007704a491f302037b40cd3e2b3bf' 
  AND (
    token = 'iWF8DsJc2EehzQqODVlpHLFTjgosY/1Y+3iH8YpssBk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030