Zahdam al-Jarmi narrates from Sayyiduna Abu Musa al-Ash'ari (may Allah be pleased with him) that the Prophet (peace and blessings be upon him) said: "In sha' Allah (if Allah wills), whenever I swear an oath and then something else is better than it, I do that and give the expiation for my oath."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الأيمان / 19845