Abu Hurairah (RA) reported Allah's Messenger (ﷺ) as saying: He who took an oath and then found another thing better than (this) should expiate for the oath (broken) by him and do (the better thing).
Related hadith on this topic
Explanation & Benefits
Shaykh Dr. Abdur Rahman Freywai
Explanation:
1:
The hadith of Abdur Rahman bin Samurah, which has been mentioned earlier, and the wording of the hadith in this chapter, both collectively indicate that it is permissible to pay the expiation (kaffarah) for breaking an oath (qasam) both before and after breaking it. This is the position of the majority (jumhur). As for those who say that paying the expiation for an oath before actually breaking the oath is not valid under any circumstance, the hadith in Abu Dawud, “Fakaffir ‘an yameenik thumma i’ti alladhi huwa khayr” (“So offer expiation for your oath, then do that which is better”), is an argument against them. In this hadith, the word “thumma” (then) after expiation indicates sequence.
Source: Sunan al-Tirmidhi – Majlis ‘Ilmi Dar al-Da‘wah, New Delhi Edition, Page: 1530