UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C41n7ao9LxMwswb1E0nrpAE9RE/9IGY2orLPLlTs5Hw=' 
WHERE 
  key_id = '7f7e199adebbac2336f184f400fa52092049314d0aa62338f2a9274b7f1524e9' 
  AND (
    token = 'C41n7ao9LxMwswb1E0nrpAE9RE/9IGY2orLPLlTs5Hw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032