The missed prayer represents an outstanding obligation, while the current prayer has a time-bound obligation. When both fit, sequencing is observed; when the current prayer would lapse, its prescribed time takes priority.
Opening interactive controls...
Why the current time can override ordering
Making Up Missed Prayers: Obligation and Sequence
The missed prayer represents an outstanding obligation, while the current prayer has a time-bound obligation. When both fit, sequencing is observed; when the current prayer would lapse, its prescribed time takes priority.