A delete actually locks all rows that are scanned in the query.
The idea is that if we delete by primary key, then no other rows will be locked thus avoiding the deadlock hopefully. For deadlock info see https://github.com/matomo-org/matomo/issues/15545#issuecomment-588916822 and below.
Checked other Option::deleteLike but they seem fine.
Be great if that could make it into 3.13.3 since we would likely be facing these issues a lot too.
I haven't tested if it actually prevents the deadlock but hoping so. We will otherwise need to reopen #15545 if it doesn't.
Background: When we set an option, we set basically
$id_$processId. So this should prevent the lock when we delete the key directly by primary key since the appendix
_$processId should be different and not prevent the insertion of another key.