My understanding is the foam ages and after 5 or so years its recommended to replace it. UV is increase the aging process.
4 years ago I bought a new Giro Synthe MIPS, it just cam out. 2 weeks later I crashed and cracked the helmet. I compare the impact to getting hit in the head with a basket ball rather than a baseball. I replaced it with the same, since it worked so well and maybe after next year i'll replace it.
As we all know, we don't heal as fast as we used to so for an average of $50/year not to have a helmet over 5 years old, it's cheap insurance for me.