Get result from select exists, execute insert query based on the response of it
Create a UNIQUE index or constraint on (col1, col2, col3) - if you don't have one already.

Then use INSERT ... ON CONFLICT ... DO NOTHING. That's simpler, faster and more reliable, and unlike the route you had in mind, it's also safe against race conditions.

Related:


What does a CONSTRAINT have to do with my unique index?
What happens with duplicates when inserting multiple rows?


Be aware of NULL handling:


PostgreSQL multi-column unique constraint and NULL values