UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dz1y2C6UioaV6VaZ32mKCCVxmwcn+dboLTMDYGa0LUw=' 
WHERE 
  key_id = '63c65493b83d7fe3480fa24d9c4e3f97f6648f0f92c32e160df710cf58412713' 
  AND (
    token = 'Dz1y2C6UioaV6VaZ32mKCCVxmwcn+dboLTMDYGa0LUw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037