All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger. We ask Allaah to exalt his mention as well as that of his family and all his companions.
If you are sure that the mucus was there before ablution and it has solid body and impermeable that prevents water from reaching the skin underneath it then your action, i.e., repeating ablution and prayer, was correct. It is reported in an authentic narration that the Prophet saw a person offering prayer, and on the back of his foot a small part equal to the size of a dirham (silver coin) remained unwashed during ablution; the water did not reach it. The Prophet commanded him to repeat the ablution and prayer. [Abu Daawood]
If the mucus was not solid and does not prevent the water from reaching the skin then your first ablution and prayer were valid.
If a person observes impurity on his body after offering the prayer and can not determine whether it was there before the prayer or not, then the prayer is valid. It is written in 'Ar-Rawdhul Murbi', a book of Hanbali Fiqh: 'Whoever finds some impurity on his body after completing his prayer and was not aware of it during his prayer, he does not have to repeat his prayer, for the possibility of it happening after he finished praying. And the prayer can not be invalidated merely by the doubt.'
If he is certain that the impurity was on his body during the prayer then he has to repeat the prayer according to the opinion of Al-Hanabi, and As-Shaafi'ee schools. Some others are of the opinion that if he comes to know the existence of the impurity after completing the prayer or remembers it after concluding, then he does not have to repeat the prayer. This is the opinion of Ibn 'Umar Ibn Al-Minthir, Ibn Taymiyyah, Ibn Al-Qayyim and Ibn Qudaamah. Imaam An-Nawawi said: 'This is the opinion of Imaams Rabee'ah and Maalik which is based on strong evidence and it is the predominant opinion.'
The evidence that proves it is not required to repeat the prayer is the narration that while the Prophet was leading his companions in a prayer, suddenly he took off his sandals and laid them on his left side; when the people saw that, they removed their sandals too. When the Prophet finished his prayer, he asked: "What made you remove your sandals?" They replied: "We saw you remove your sandals, so we removed our sandals." The Prophet then said: "Jibreel came to me and informed me that there was impurity on them…." This narration proves that the Prophet did not repeat the prayer which he had performed after knowing the existence of impurity during his prayer, which means that his prayer was not invalid.
Allaah Knows best.