UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uOJQx7ySCDRD1r6BdQA2OGX3/TujhNUCOXP1OBWM0oM=' 
WHERE 
  key_id = '09c6d21708c9364f583d9e0f22939e1a70e18c3b22659e4e4377ed12cdeaa313' 
  AND (
    token = 'uOJQx7ySCDRD1r6BdQA2OGX3/TujhNUCOXP1OBWM0oM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028