Record the time when the input goes from low to high. When 5 * 60 * 1000UL milliseconds have elapsed, trigger your output.