UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'inBD2P5PnLUH3YOz1IBW6B7Ab+7SnvlDVanDSFEB0JQ=' 
WHERE 
  key_id = 'a36c28ea2a013ad93863c65acf295456c03fa8be79117ff1a77a24aa2cd8310d' 
  AND (
    token = 'inBD2P5PnLUH3YOz1IBW6B7Ab+7SnvlDVanDSFEB0JQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035