UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e+OiL+36EK8fgMUz79UMs1YYCywwK72V4yeccrvwSus=' 
WHERE 
  key_id = '508734a7a8c80b46c9aa3b014f416e4308ecd9494149675fb2a0628ddeb6f0a1' 
  AND (
    token = 'e+OiL+36EK8fgMUz79UMs1YYCywwK72V4yeccrvwSus=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028