I overstayed my ESTA for about 51 days when I went to the US. When I checked my ESTA status online it says approved. Can I travel back to the US on the same ESTA, or do I have to apply for a new one?
If you read the answer to the first question in the Updating your ESTA section of the CBP's ESTA FAQ you'll see that a new ESTA application is required if your answer to any of the Yes/No questions in the ESTA application changes. Since one of those Yes/No questions asks whether you have overstayed on a previous admission to the US you'll need to make a new ESTA application to update that answer.
Unfortunately, if you do submit a new ESTA application that includes a "Yes" answer to that question it is highly likely that the application will not be approved. Similarly, if you travel again on you existing ESTA you will probably be refused entry. This is because the enabling legislation for the Visa Waiver Program, at 8 USC 1187(a)(7), makes one forever ineligible to enter under the VWP if the alien has violated the conditions of a previous VWP admission, which you have apparently done. They have little or no discretion to waive this ineligibility so you will likely require a visa for future US travel.
You might want to wait a while before applying for a visa. While a 51 day overstay won't result in a mandatory admissibility ban it will make them uncomfortable about the likelihood of you complying with the conditions of future admissions. The further in the past the indiscretion is, the less discomfort they are likely to feel.
It's important to note that even though an ESTA is valid, it only makes you eligible to board an aircraft to the United States - it is not any sort of entry clearance and does not guarantee you entry into the United States.
In your case, the ESTA will allow you to fly to the US but you may be refused entry by an Immigration Official on the basis of your overstay.
In the same way that a valid visa does not guarantee admission to the United States, an approved ESTA is not a guarantee of admission to the United States.
If you are in any doubt at all regarding your eligibility for entry, you should apply for a visa before travel - the US Customs and Border Protection do warn that a valid visa is not a guarantee of entry into the US, but at least you would know if it's likely to be an issue if they deny you a visa.