There's not a definite answer. It depends on the pH of your water to begin with, how much debris is allowed to enter the vessel and how much material you sanitize with it. Starsan is an acid sanitizer, meaning that as long as the pH is below a certain threshold (in this case, I believe it's 3.0), it should remain effective.
I remember learning early, "when it's cloudy, it may or may not be bad. But, if it's bad, it will become cloudy." - So, for me, I usually throw out when it starts to become cloudy without even testing pH. It's really not that great of a cost at our scale. I also usually mix up only 2 1/2 gallons at a time.
All that aside... I keep saran wrap and foil over my prepared starsan bucket (I lost the lid or I would use that) and typically keep it for a month or two across several batches. I also clean and rinse very well before sanitizing.