If you don't ride the bike at all, the rubber still ages and gets brittle. But that takes years.

Otherwise replace it when the tires are worn. Not just the tread but the rubber.