core: Fix/unify SQL for forward message fetch