The mysqli_thread_id() function returns the thread ID for the current connection which can then be killed using the mysqli_kill() function.
Note: The thread ID is assigned on a connection-by-connection basis. Hence, if the connection is broken and then re-established a new thread ID will be assigned.