UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ctEtswzI5v4oNazJxkSKezF3VZciAbeYZ7TXx6orhC4=' 
WHERE 
  key_id = '1d469477202910a6cad1f524aa6118898f3b356809b630aa27d161bc6aff7ee6' 
  AND (
    token = 'ctEtswzI5v4oNazJxkSKezF3VZciAbeYZ7TXx6orhC4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030