UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Vroghc3sh5Eglx6TroLHrjovixFEZlqtVIb+Zgd/0Xw=' 
WHERE 
  key_id = 'b30cc85bab7e918fe75ce81434b824d68495c751079a6330b4c877b68fd891a4' 
  AND (
    token = 'Vroghc3sh5Eglx6TroLHrjovixFEZlqtVIb+Zgd/0Xw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037