Optimize inbox SQL queries

Do we need this query anymore since transaction now contains current_state?