So many variables. How it was stored, where it was stored, how strong was the beer. Also hops use is part of the equation. More hops generally means stores longer.
The ancient Egyptian beer was estimated to about 7%. Not really high enough to make a big difference, it generally takes 20% to make a major difference.
Storing the beer in a cellar or a cave will help.
Beer meant to last longer would have been stored in a clean baked clay vessel and sealed with wax or the like.
All this adds up to anywhere from a couple of months to a little over a year at best.
In theory a lot of weak beer was made for many thousands of years as it was often safer to drink than water. But I recall some holes knock in this old theory more recently.