UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GXAk+RlG9uvEhScGNrCxBDQpD+ByhePkBMWzccHUTe8=' 
WHERE 
  key_id = '9894dbe32d1fe60af0d868402f9bade9d59eba6ed694e8786cefd59b3e0f5930' 
  AND (
    token = 'GXAk+RlG9uvEhScGNrCxBDQpD+ByhePkBMWzccHUTe8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036