UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sDXBHWTjnA2JKp4wHLgysn6Tjhl3CIscIVpqOpvP8Rs=' 
WHERE 
  key_id = '44a24b6f11234de7e583c7db9fa7112b7273177d16f71a006e7b78cac2d64819' 
  AND (
    token = 'sDXBHWTjnA2JKp4wHLgysn6Tjhl3CIscIVpqOpvP8Rs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028