The U.S. National Archives and Records Administration has a report called Frequently Asked Questions (FAQs) about Optical Storage Media
which says "CD/DVD experiential life expectancy is 2 to 5 years even though published life expectancies are often cited as 10 years, 25 years, or longer." They discuss various factors which can impact life expectancy and recommend that you test your media every two years to make sure it's still readable.
A study by the Canadian Conservation Institute is more optimistic, suggesting that "the lifetime of recordable optical discs can range from a couple of years to more than 200 years." The report also lists several factors that can lead to failure of discs in 2 to 10 years. Chief among those are improper storage and handling. They advise to hold the disc using the center hole and outer edge, and not to touch, write on, or use adhesive labels on the surface of the disc. For storage, the recommendation is to keep discs in a cool, dry environment, stored vertically in a jewel case. Other important factors are choosing a well-known brand name, and recording the information properly to ensure a low error rate.
But wait a minute! You say that your CD or DVD discs are still readable after 10, 20, or more years? But clearly there are factors that can cause premature failure of optical discs. If your discs contain music or video, a slight degradation might only cause a hiccup during playback. But if you're storing documents, spreadsheets or other important data, even a few errors could cause them to become corrupt or unreadable, perhaps within 3 to 5 years.