Most people can hold focused attention for somewhere between 15 and 45 minutes before it naturally wavers, with roughly 25 minutes being a common comfortable stretch for demanding work. It varies a lot by individual, task, interest level and how rested you are.
The practical takeaway is not to fight your limits but to work with them: focus in blocks that match your real attention span, take proper breaks, and extend the blocks slowly over time. Trying to grind for hours without a break usually produces worse work, not more.