You could do two queries to get the Ids of the desired entries, merge the Ids and then query the entries with these Ids:
{# Get Ids of desired entries #}
{% set startDateIds = craft.entries.startDate('and', '>= ' ~ unixbegins, '< ' ~ unixends).ids() %}
{% set endDateIds = craft.entries.endDate('and', '>= ' ~ unixbegins, '< ' ~ unixends).ids() %}
{# Merge queried Ids #}
{% set filteredIds = startDateIds|merge(endDateIds) %}
{# Get entries with Id paramenter #}
{% set filteredEntries = craft.entries.id(filteredIds) %}
.
Another idea is to query all potential entries, loop those and filter within the loop. This is probably the way to go if you need to combine your conditionals with other logic then the and
operator:
{# Get all potential entries #}
{% set allEntries = craft.entries.section('events').limit(null).find() %}
{# Define array before loop #}
{% set filteredEntries = {} %}
{# Loop all entries #}
{% for key, entry in allEntries %}
{# Set conditionals to filter for desired entries #}
{% if ( entry.startDate >= unixbegins and entry.startDate < unixends ) and ( entry.endDate >= unixbegins and entry.endDate < unixends ) %}
{# Merge entries #}
{% set filteredEntries = filteredEntries|merge({ (key): entry }) %}
{% endif %}
{% endfor %}
date('U')
filter inside the query as you wrote here?