Heat a medium saucepan over medium heat and add the oil. Sauté the onion for about 5 minutes soft and then add in the garlic and cook for another minute. Add the chopped tomato and cook for 2 minutes.
Stir in the spices and salt and let them simmer for about 30 seconds before adding the refried beans. Stir everything together and add a splash of water, if needed, to loosen the beans a bit.
Continue stirring and bring everything to a simmer. Switch off the heat when the refried beans are heated through.
Garnish with grated cheese and chopped cilantro, if desired.
