[ticket/11731] Replace captcha session table queries

PHPBB3-11731