EPS used in bicycle helmets remains effective for a very long time. Of course, plastics age, styles change and--hopefully--more current designs and construction make safer helmets. However, if I had to choose between no helmet and a 20 year old helmet in reasonably good condition, I'll take the old helmet.
Manufacturers and retailers, due to both liability concerns and the desire to sell new product, don't want their products to last forever lest they forgo the revenue of selling new helmets.
At the link below is a summary of testing of older helmet.
https://helmets.org/helmetlineraging.htm