Hi Anshuman,
Yes. If you clear the AZ-400 exam while holding an active AZ-305 certification and an expired AZ-104 certification, you would still earn the Microsoft Certified: DevOps Engineer Expert certification, as long as your AZ-305 is valid.
The key requirement for AZ-400 is holding an active certification in either: AZ-104 or AZ-305.
You can also verify this certification prerequisite section (at least one of the following).
https://video2.skills-academy.com/en-us/credentials/certifications/devops-engineer/
Thank you.