As a national of Pakistan, you require an airport transit visa in the Schengen area (including Hungary) as well as countries applying Schengen rules in view of joining the area (Bulgaria, Romania, Cyprus). You would be exempt if you hold a visa or residence permit from any EEA countries, Canada, Japan, or the United States. You are also legally exempt if you are a family member of an EEA citizen and you are travelling with them or joining them.
UK is no longer in the EEA so its residence permit no longer matters.
However, for the family exemption, you may have practical problem when boarding the flights as the family member exemption is not explicit in Timatic or TravelDocs for Cyprus (the exemption is shown for Hungary), which is often used by the airlines to decide if you may board a flight or not for immigration reasons. The airlines may also refuse boarding if they are not satisfied that you are a family member of the EU citizen.
The more straightforward way that facilitate your travel is probably to apply a Schengen visa to Hungary (or any Schengen country) as a family member of an EU citizen, stating you will be travelling with your EU spouse in exercise of your freedom of movement under EU law. The visa by law should be free of charge and processed within 15 days. A Schengen visa exempt you from all airport transit visa requirements in the EU.