You're going to want to check if the person is an Admin or higher
if ply:CheckGroup( "admin" ) then
and if they are, do nothing
So this is what you would add:
hook.Add("Think", "HandleAFKPlayers", function()
for _, ply in pairs (player.GetAll()) do
if ply:CheckGroup( "admin" ) then return end
-- Rest of your code here