Chest pain with an accelerated heartbeat after a stimulant is something you really can't ignore. Two glasses back-to-back is a pretty high dose, and yeah, it can cause all of that together - but the thing is: you need a doctor to figure out if it was just a caffeine overdose or if there's something else going on. It's not something to handle on your own at home.
Go to an emergency room or call a cardiologist as soon as you can. Take it seriously. The discomfort might go away naturally as the stimulant leaves your body, but that chest pressure combined with a racing heart isn't something to brush off, especially since it's never happened to you before. It could just be sensitivity to the energy drink, could be something else - only someone who can examine you in person can say for sure.
The thing a lot of people don't pay attention to: energy drinks aren't just caffeine, they've got taurine, guarana, sugar and all kinds of other stuff that messes with your cardiovascular system. Some energy drinks have way more stimulant concentrated in them than you'd think, and having two doses in quick succession can be a real scare for someone who isn't used to it. So heads up - next time (if there is one), take it slower and make sure to tell your doctor what happened, that'll help with the diagnosis.