Great! Thanks a bunch. Not sure why it would matter, since the docs claim that all three syntaxes (MOD(N,M), N % M, N MOD M) work, but I had to make the following change:
SET @id := 0;
SELECT *, @id := (@id + 1) AS id
WHERE timestamp > $starttime
ORDER BY timestamp
) AS intermediate
WHERE NOT (id MOD 5);
in order to get rows back. "NOT id % 5" gave me a null set. But thanks a lot! That really helps.