Mammals remove excess nitrogen from their bodies by converting it to a dilute solution of urea, stored in the bladder. Birds convert nitrogen to uric acid instead: this is metabolically more costly but saves water and weight, as it is less toxic and doesn't need to be diluted so much. Birds therefore don't have a urethra, and don't pee - all waste leaves via the anus.
Chickens only have one hole, so their waste is all mixed within the intestines before it's evacuated. Basically the poop, pee and pay eggs from the same hole. It's not exactly done in the same way as mammals do, but it pretty much narrows down to the same: getting rid of waste.
The oldest I've seen is about 11, one of which was a rooster, so no egg production. I've heard of 21, but I'm not sure I believe it. My 11 year old hen is doing okay, but getting old. Even my bantams, who had low egg production only lived for about eight years.
The AVERAGE lifespan of any wild animal is generally significantly shorter than the lifespan of a wild animal in captivity, barring wild animals like whales that have few predators and other species that do poorly in captivity. A wild chicken in the wild will have a rather short lifespan due to being eaten. (For comparison, their close relatives, pheasants, are lucky to live three years in the wild, and wild turkeys are also lucky to make it past three.)
The 30 years thing sounds more like a world record to me than an actual lifespan. Unless you can find multiple sources saying jungle fowl live to be 30, I can't believe it.
I am aware the commercial breeds die young. I've noticed this with my own flock, but I still don't believe the claim of 30 years old as an average lifespan.
Most of my hens are more fancy breeds, so they tend to live longer because they're not so heavily bred to lay. (Like I said, I've got one who is eleven and is probably the most similar to jungle fowl that I have.)