Yes you cna self certify you were ill, but thats for employment law.
You have a problem. How do you know it was a migraine? You havent been to the Drs in 5 years, which presumably means you arent receiving treatment and could be making it up and thye have to believe you retropsectively. I cna imaine a Dr who has never met you will be reluctant, but if you manage it right, then you have a chance.
You need to ask them if they would or could give you a note and then you need to describe the symptoms of the migraine to them so they can at least recognise what you had. Obviously voimiting, pain and incapacitation would be a good start. there is a way they can word it if they are willing. Tbh you should have gone beforehand and also you should have alerted the uni beforehand as retrospectively looks supicious. Think about it and negotiate with them its pot luck whether you get someone sympathetic.
You might as well have a try to get one and if one Dr wont give it you then go to another. 5% is worth fighting for and you could maybe ask for a compromise i.e a chance to sit the exam at a different date. Hopefully you already have good attendance and good grades.
Good luck, but really you should have dragged yourself to the GP before.