Set a timeout for jobs that could take too long

Hi,
as the title already says I want to achieve setting a custom timeout for fire-and-forget jobs, that take too long.
In my job there is the possibility that it takes too long (e.g. ~5 min.)
So I want that this job gets set to failed, if it exceeds a certain timeout value. How is this possible now? I already read about the InvisibilityTimeout, but this is already deprecated now and I do not know how to achieve somehow else.

Any help appreciated :wink: