I guess the best thing would be to think in advance (for future occasions) of something authentic to say in such a situation (accurately describing your positions on whatever it is that requires that you be sympathetic). We're not lacking in empathy, we just take the world on "logical" terms instead of "emotional-response" terms. So we can use our "logical" embrace of life to everyone's advantage.
Example if you're, let's say, an animal lover:
Them: "My cat died."
You: "Oh, I'm always sad when I hear of an animal dying. There are such special emotional bonds that so many of us (including me) feel with animals, so when I hear about your cat dying, it's painful to hear about. I never met your cat but I can imagine how much you loved him/her and how much he/she loved you."
Or something like that. The point is, you're NOT misrepresenting yourself or your feelings and thoughts on the matter (if you were, it would be an example of what I would think of as "sucking up"). You're also not hurting them, and you're showing that you understand the effect that the unfortunate event is having on them and that you regret that it happened, even if you can only empathize with them very little (if at all).
_________________
Male-bodied pansexual and panromantic.
Your Aspie score: 130 of 200
Your neurotypical (non-autistic) score: 90 of 200
You are very likely an Aspie
EQ Score: 37/100 ("low empathy")