How to ensure Database Query does not return all records if condition is not met?

Well the condition in the filters tab is only user to apply the filter or not.
If you want to conditionally run a database query use the condition step in server connect.