A rule of thumb is 20 years for double based powders and 45 years for single based. The lifetime of ammunition depends on the lifetime of the propellant.
Heat is the worst enemy of gunpowder, heat breaks powder down. If stored in arctic conditions, -40 F, unchanging cold and no humidity, I have no idea how long it will last, maybe a century, but stored in hot conditions, take a look at this:
United Nations (UN) Manual
IATG 07.20 Surveillance and in-service proof
See Paragraph 7.3, how temperature reduces the lifetime of ammunition.
Understand that militaries undergo stockpile surveillance programs to weed out ammunition that is just about to go bad, or has gone bad. That is why there is all this cheap surplus ammunition on the market, the original owners dumped the stuff as unsafe.
When old ammunition is fired all sorts of evil things can happen, pressure spikes that lead to blowups are the worst, duding is perhaps the least of anyone’s problems.