why do people use cryptographically signed tokens for secret tokens (reset password / confirmation)? it should be safer to generate a random string and if the token needs to expire to store a timestamp in the database. revocation can then be performed on individual tokens. I can see why people might be more tempted to use these crypto-tokens for session storage to avoid the database but I think if this is a requirement then you should be using redis or some other fast key storage to hold the sessions.
if you are worried about timing attacks then you can just have your routes in the form of `/user/<id>/reset_password/<token>` and pull the user out of the DB and then do the comparison using a timing safe function. alternatively, if that is not possible and you need to do a lookup by the token its possible to blind the value stored in the DB but i would avoid that because it introduces another cryptographic primitive unnecessarily. and having only index on user_id and not having to have indexes on all your tokens saves space as well!