Query to check if column value appears more than once then apply condition


I have a PostgreSQL query:

SELECT DISTINCT ON ("contract"."contract_id") "contract"."id"  FROM "contract_versions" "contract"  WHERE "contract"."client_id" = 1  GROUP BY "contract"."contract_id", "contract"."id"  ORDER BY "contract"."contract_id", "contract"."change_effective_date" DESC 

I want to add something like if contract_id occurs more than once then change_effective_date >= now()

I tried using:

SELECT DISTINCT ON ("contract"."contract_id") "contract"."id",        COUNT("contract"."contract_id") AS cnt  FROM "contract_versions" "contract"  WHERE "contract"."client_id" = 1  AND CASE WHEN "cnt" > 1 THEN "contract"."change_effective_date" <= now() END  GROUP BY "contract"."contract_id", "contract"."id"  ORDER BY "contract"."contract_id", "contract"."change_effective_date" DESC 

but its throwing an error column “cnt” does not exist

Thanks