Upvote:2
According to the Mexican Embassy in Finland (emphasis added):
Foreign nationals, regardless of their nationality - exempt holders of UK travel documents (blue or black)- holding a valid USA B1/B2 visa, UK C- visitor visa, Canadian visitor visa, Japanese visitor visa or Schengen C-visit visa stamped in a valid passport, provided that the visa is to be issued for multiple entries and continues to be valid during the intended period of stay in Mexico do not require a visa to travel to Mexico as non-lucrative visitors.
So, while it is no problem that your visa expires after the your intended stay in Mexico, you do not have the correct US visa to make this trip, and you should apply for a Mexican visa, unless of course you are the holder of a passport from one of the countries and regions which do not require a visa to travel to Mexico.