As helmets are nominally PPE the manufacturer has to give the product a lifespan. For most soft goods (fabrics and webbing) this is 5 years and for metal items 10 years.
Even UV stabilsed webbing degrades in sunlight but abrasion and cuts are more of an issue. With a cycling helmet the buckle is the weakest point and will likey always fail before the webbing unless it’s cut or damaged.
I’m not sure what foam degradation is like or how small knocks effect its energy absorbency.
A number of years ago we tested some old climbing helmets and they all passed the standard but were mainly webbing cradle shock absorbers not foam.
Pragmatically if it looks very battered replace it or pick a number between 5 and 10ish years depending on how much you use it feels sensible.
N.B. lifetime is usually quoted from time of first use so if stored correctly a 2021 helmet should be no issue, although I think it is stretching a point from the seller unless on very special price.