CDs and DVDs, if not scratched, should last a long time (some specs state 100+ years, probably longer than there will be CD / DVD readers). NFS Carbon is the only NFS game made before 2008 where the online servers (for PC version) are still running, and that may stop at the end of this year. The online servers for any of the other older games were shutdown years ago, and there is no online activation so purchasing a used copy isn't an issue.
Undercover was the first NFS with online activation for a EA DVD version of the game (activation would be automatic with an Origin or Steam version). Shift 2 Unleashed requires sign in to unlock any additional "DLC" content like Limited Edition, but currently the unlock feature is broken and I don't know if EA will ever fix this. Origin and Steam stopped selling the Limited Edition of Shift 2, but online retailers still sell the DVD Limited Edition, which will be facing the same unlock problem (meaning a player won't be able to unlock the Limited Edition content, even though the player paid for it).