I found a way which maybe is useful for anybody.
As I want to change the deleted
field, restrictions have to be removed:
To handle complicated SQL situations the add()
function is appropriate.
Thus, this code works:
$queryBuilder = $this->connectionPool->getQueryBuilderForTable(tx_myevents_domain_model_event);
$queryBuilder
->getRestrictions()
->removeAll();
$queryBuilder
->update(tx_myevents_domain_model_event)
->add( 'where', '(datetime_end + (days_until_deletion * 86400)) < UNIX_TIMESTAMP()')
->set('deleted', '1');