UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bYqkKPWvipMd8DCS2US4rDImxkpaZOJiE4TNnDFx1mg=' 
WHERE 
  key_id = 'd7fa72e2c67702940f0ad0deb7f399e461a837e0135ee2effd93598b19dee6ad' 
  AND (
    token = 'bYqkKPWvipMd8DCS2US4rDImxkpaZOJiE4TNnDFx1mg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026