You just have to change the second line of your second code-block from:
{% if myVar is in_array(array_keys(someOtherArray)) %} # or {% if myVar in someOtherArray|keys %} inin is the containment-operator, and keyskeys, is a filter that returns an arrays keys.