The call is OK, as you say, you're just trying to hit a set, an are looking at $2.90 for a shot at $47+. You get into difficulty though when the raiser and re-raiser have hands like AK and aren't going to put much more in the pot, so calling the re-raise might not be positive EV. Plus anyone with a pocket pair may also hit a set and stack you.
I'd be less inclined to call here though because you're sitting in between the re-raiser and the original raiser, and there's a chance you may get squeezed. The idea is to get in cheap and they've made it more expensive.
Did you think about slow-playing this on the flop? If you just call, you might keep the third player in, and if you're lucky he'll be on something like a flush draw, or may think he has odds
to call with overcards. If the bettor does have something like AK, you won't get any more on the pot with a raise, and giving a free card may turn up an Ace or King which will pay you off.
On the other hand, AA has 4 outs on the flop and is about 17% to outdraw you, so playing it fast isn't too bad.