SQL kill query via hint/comment directly in the query

— Kill the query after 1,000 milliseconds
SELECT /*+ MAX_EXECUTION_TIME(1000) */ * FROM t1 INNER JOIN t2 WHERE …

dev.mysql.com/blog-archive/server-side-select-statement-timeouts/