As others have said, depends on the individual horse. I'd definitely consult with a vet on any horse of significant age. Our old stud is 30, I don't do live cover with him anymore or breed outside mares but do have him collected for my own use.
His sire, my grandpa's old stud, had his last colts on the ground the year he died at 36. His motility was as high in his 30s as it was as a young horse. I've seen many older mares (they were lifetime broodies though, none maiden) foal very late in life, the oldest on our farm was 28, she was one that belonged to my grandpa. I'd be pretty leery at that age myself but with vet clearance and closely monitored pregnancy she did very well.
Life is like a camera. Focus on what's important, Capture the good times, Develop from the negatives and if things don't work out, Take another shot.