psql - update only if row exists (IF THEN)

psql - update only if row exists (IF THEN)

I'm looking to run the follow query:

I'm looking to run the follow query:

UPDATE
    creator.contacts
SET
    status = 'accepted'
WHERE
    (
        account_id = $1
        AND
        contact_id = $2
    )
    OR
    (
        account_id = $2
        AND
        contact_id = $1
    )

But only on a certain condition, which I query using the following:

SELECT
    COUNT(*)
FROM
    creator.contacts
WHERE
    account_id = $1
    AND
    status = 'pending'

Is it possible to combine this into one query?

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

MySQL vs PostgreSQL - What to Choose the Right Database for Your Project

Perhaps you're building a brand new project. Or maybe your current database isn't working well. Choosing the right database for your project can be given by MySQL or PostgreSQL?

MySQL Database Bootcamp: Go from SQL Beginner to Expert | Simpliv

MySQL Database Bootcamp: Go from SQL Beginner to Expert

SQL Full Course - SQL Tutorial For Beginners - MySQL Essentials - SQL Training

This SQL Full Course video will cover all the topics of SQL starting from scratch. This video is great for beginners who want to learn SQL and for advanced people to brush up their skills.