If buying to have "in stock" for when your battery fails:
Lead/Acid not filled = forever
AGM never used depends on storage conditions - in a climate-controlled garage the worst I've had was a year and I had one for about three years that was fine when I installed it.
Shorai LFX18A1-BS12 (the only I use) again, I suspect, depends on storage conditions but I've never had one not work after sitting on a climate-controlled shelf unused. I buy 2-3 when I find a good deal and no telling when I will use them.