It is done in the mark_thread_read() function of ./includes/functions_bigthree.php.
I would however advice against changing it, as it is not using a sutdown query on purpose:
PHP Code:
// can't be shutdown as we do a read query below on this table
$db->query_write("
REPLACE INTO " . TABLE_PREFIX . "threadread
(threadid, userid, readtime)
VALUES
($threadinfo[threadid], $userid, $time)
");