You can use the SQL script I wrote up below to build a dynamic SQL string that will kill all blocking sessions that have been running for at least 5 minutes.

You'll want to create a SQL Agent job ([SQL Agent Job Docs][1]) that executes this SQL script. (You can schedule the SQL Agent job to run as often as every second if you want.)

    -- Variable to hold dynamic SQL of what blocking sessions will be killed
    DECLARE @DynamicSQL AS NVARCHAR(MAX) = '';
    
    -- CTE of blocking sessions
    WITH CTE_BlockingSessions AS
    (
    	SELECT blocking_session_id
    	FROM sys.dm_exec_requests
    	WHERE blocking_session_id <> 0
    )
    
    -- Sets the @DynamicSQL variable = 'KILL ' + all blocking session IDs that have been running for at least 5 minutes
    SELECT @DynamicSQL = @DynamicSQL + 'KILL ' + CAST(BS.blocking_session_id AS VARCHAR(10)) + ';'
    FROM sys.dm_exec_requests AS ER 
    INNER JOIN CTE_BlockingSessions AS BS
    	ON ER.session_id = BS.blocking_session_id
    WHERE DATEDIFF(s, ER.start_time, GETDATE()) >= 300 -- 300 seconds = 5 minutes
        AND ER.[status] = 'RUNNING' -- Ensures the blocking session is still active

    -- PRINT @DynamicSQL -- For testing, outputs the dynamic SQL to SSMS Messages tab
    EXEC sp_ExecuteSQL @DynamicSQL -- Executes the dynamic SQL


  [1]: https://learn.microsoft.com/en-us/sql/ssms/agent/create-a-job?view=sql-server-ver15