SELECT CASE WHEN
    (SELECT COUNT(*) FROM `dwd_process_outsource_delivery` WHERE `tenant_id` IN (0,1,1300000000001))=0
AND (
      SELECT COUNT(*) FROM information_schema.TABLE_CONSTRAINTS
      WHERE CONSTRAINT_SCHEMA=DATABASE()
        AND TABLE_NAME='dwd_process_outsource_delivery'
        AND CONSTRAINT_NAME='ck_dwd_process_outsource_valid_tenant'
        AND CONSTRAINT_TYPE='CHECK'
    )=1
THEN 1 ELSE 0 END AS ok;
