Snopes:
Claim – Hostess Twinkies have an indefinite shelf life.Fact – Twinkies have a shelf life of twenty-five days, not seven years, and certainly not fifty years. Even so, twenty-five days is an unusually long time for a baked product to stay fresh. The secret to Twinkies’ longevity is their lack of dairy ingredients: because dairy products are not part of the formula, Twinkies spoil much more slowly than other bakery items.
After the news of the shuttering of the company, this urban legend quickly made its way around Twitter. Like most urban legends, it turns out to have no basis in facts.