I said "in the php code after". 
The queries are all fine, it's the block of code between the two queries (or at least it was, now seems to be running fine).
This is the detail of the debug I was looking at:
SELECT permission, add_deny
FROM elkarte_permissions
WHERE id_group IN (2, 8)
in .../sources/Load.php line 737, which took 0.00011396 seconds at 0.00559998 into request.
SELECT variable, value, id_member, id_theme
FROM elkarte_themes
WHERE id_member = 2
AND id_theme = 1
in .../sources/Load.php line 1259, which took 0.00018001 seconds at 5.01269984 into request.
See?
The two queries were running smooth, but the "time into request" suddenly dropped from microseconds to 5 seconds.
That means some php code was wasting a lot of cycles.
The first query is run in loadPermissions, while the second is in loadTheme.The only things done between the two is banPermissions and loadBadBehavior.
Now, banPermissions doesn't seem to do anything that can result is 5 seconds of processing.
While loadBadBehavior should not be loaded for moderators, and in theory I am a moderator, so either the problem is not in badBehaviour or there may be still some case where moderators are not recognized as such. In any case I'm not a BB expert so I don't know if the code could end up into some odd scenario producing such result.