Only hit prepared query cache when planning (avoid extra lookup)

signed-off-by: Jakub Wieczorek <jakub.wieczorek@neotechnology.com>