As noted by others, Tube quality is the main factor in how long they last. I've had varying degrees of success on storing tubes for long periods of time.
In general, tubes lasted longer if not exposed to dust, humidity or solvent vapours, oils, and not exposed to sunlight, either well packed away or properly mounted on a tire and taken care of albeit not being in use.
I'll share a few anecdotes to back up what I've found.
I have stored tubes for at least 7 years where they have been in cardboard boxes (not original packaging), inside the house. (Ambient temperature ranging 20-30 Centigrade) and they where just fine when finally used.
On the other hand, tubes I left outside exposed to humid, tropical air developed some defects that rendered them useless. I note that there was some paint solvents and engine oil stored nearby, but not in direct contact nor in the same shelf. They weren't exposed to direct sunlight either.
The defects where of two kinds: Some tubes turned black and somewhat tacky. (Remember tubes are not "black", but a very dark, dull gray). Upon inflating these tubes would split open like banana peels. I have had this problem with tubes stored inside the house inside airtight plastic bags also.
Other tubes seemed fine at first but when inflating them outside tire, they wouldn't expand uniformly, some parts remained at their normal diameter but other swelled disproportionately. Those parts looked lighter gray and shown a crackled surface. As I continued inflating they did burst at one of those places. The burst left a star shaped hole.
As for tubes mounted in tires on bikes I have left unused for long periods of time (5 years), they have been fine as long as I keep them with some air (not enough pressure to ride but not completely flat). If I let the tube lost all air and the tire casing disengage the rim, the tubes resulted damaged (lost their flexibility and developed cracks when I tried to inflate them inside the tire.).
I also had tubes that developed tiny, inexplicable "punctures". At first it seemed like a defective valve, but I tested them by submerging in water. That's how I discovered minuscule holes on all parts of the tube. Some of them not big enough to leak. I assume this was a manufacture defect. These tubes where darker than normal and a little tacky out of the box.