@tykus @tisuchi
Thank you.
The syntax that worked is @tykus one, moving the condition to outside the updateOrInsert (tykus used updateOrCreate of Eloquent but that's the same).
When I used tisuchi's syntax it gave some errors. For example, when I used:
DB::table('some_table')->updateOrInsert(['user_id' => 111, 'comment_type' => 4, ['last_update', '>=', now()->subMinutes(5)->toDateTimeString()]],['last_update' => now()]);
It would only work as long as it found a record within the time frame and only needed to update. But as soon as insert was needed (after 5 minutes pass), it would throw this error:
[SQL Server]Invalid column name '0'. SQL: insert into [some_table] ([user_id], [comment_type], [0], [last_update]) values (111, 4, Array, 2023-06-20 08:15:42.664)).
Converting the condition into an array and attempting to insert [0] to it