You can do something like this:
insert into cats_rel(cat_id, post_id) select 11, 32 where not exists (select 1 from cats_rel where cat_id = 11 and post_id = 32);
EDIT:
Unfortunately. This does not work in MySQL because the from clause is missing (works in many other databases). In any case, I usually write this by putting values ββin a subquery, so they only appear in the request once:
insert into cats_rel(cat_id, post_id) select toinsert.cat_id, toinsert.post_id from (select 11 as cat_id, 32 as post_id) toinsert where not exists (select 1 from cats_rel cr where cr.cat_id = toinsert.cat_id and cr.post_id = toinsert.post_id );
source share