score:1
As stated in Timatic, the database used by Airlines:
Visa required, except for Passengers with a residence permit issued by Hungary
and
Passports and other documents issued to residents of Hungary must be valid on arrival.
In other words, the airline is not supposed to let you board the flight back to Hungary with an expired residence permit.
So, you must present your Ukrainian passport when boarding the flight back, and once you get to Hungary, present both of your passports, your expired residence permit, and any document(s) proving your application for an extension. They will let you in, possibly with some delays