def METHOD_NAME(
    model: Type[Model], using: str | None = None, **kwargs: Any
) -> Tuple[int, bool]:
    """
    Similar to get_or_create, either updates a row or creates it.
    In order to determine if the row exists, this searches on all of the kwargs
    besides `values` and `default`.
    If the row exists, it is updated with the data in `values`. If it
    doesn't, it is created with the data in `values`, `defaults`, and the remaining
    kwargs.
    The result will be (rows affected, False) if the row was not created,
    or (instance, True) if the object is new.
    >>> create_or_update(MyModel, key='value', values={
    >>>     'col_name': F('col_name') + 1,
    >>> }, defaults={'created_at': timezone.now()})
    """
    values = kwargs.pop("values", {})
    defaults = kwargs.pop("defaults", {})
    if not using:
        using = router.db_for_write(model)
    objects = model.objects.using(using)
    affected = objects.filter(**kwargs).update(**values)
    if affected:
        return affected, False
    create_kwargs = kwargs.copy()
    inst = objects.model()
    for k, v in itertools.chain(values.items(), defaults.items()):
        # XXX(dcramer): we want to support column shortcut on create so
        # we can do create_or_update(..., {'project': 1})
        if not isinstance(v, Model):
            k = model._meta.get_field(k).attname
        if isinstance(v, CombinedExpression):
            create_kwargs[k] = resolve_combined_expression(inst, v)
        else:
            create_kwargs[k] = v
    try:
        with transaction.atomic(using=using):
            return objects.create(**create_kwargs), True
    except IntegrityError:
        affected = objects.filter(**kwargs).update(**values)
    return affected, False